import { setGoodsIsPrivate, setGoodsIsPrivateBatch } from '@/api/modules/data/goods';
import { table } from './data';
import { notify } from '@/utils/common/common';
import type { MenuItemType } from 'ant-design-vue/es/menu/src/interface';

export const productShareOptions: MenuItemType[] = [
  {
    label: '所有商品公开',
    key: '1',
    async onClick() {
      const { data } = await setGoodsIsPrivate(1);
      notify(data);
    },
  },
  {
    label: '所有商品私有',
    key: '2',
    async onClick() {
      const { data } = await setGoodsIsPrivate(0);
      notify(data);
    },
  },
  {
    label: '选中商品公开',
    key: '3',
    async onClick() {
      const { data } = await setGoodsIsPrivateBatch(1, table.value.keys);
      notify(data);
    },
  },
  {
    label: '选中商品私有',
    key: '4',
    async onClick() {
      const { data } = await setGoodsIsPrivateBatch(0, table.value.keys);
      notify(data);
    },
  },
];
export const fields = [
  {
    key: 'specif',
    label: '规格',
  },
  {
    key: 'itemNo',
    label: '货号',
  },
  {
    key: 'stock',
    label: '库存',
  },
  {
    key: 'grade',
    label: '等级',
  },
  {
    key: 'mode',
    label: '模式',
  },
  {
    key: 'model',
    label: '型号',
  },
  {
    key: 'freightSpace',
    label: '仓位',
  },
  {
    key: 'salesUnit',
    label: '计价单位',
  },
  {
    key: 'department',
    label: '部门',
  },
  // {
  //   key: "category",
  //   label: "分类"
  // },
  {
    key: 'shelfLife',
    label: '保质期',
  },

  {
    key: 'origin',
    label: '产地',
  },
  {
    key: 'warehouse',
    label: '仓库',
  },
  {
    key: 'qrcodeUrl',
    label: '二维码',
  },
  {
    key: 'productionDate',
    label: '生产日期',
  },
  {
    key: 'promotionEnd',
    label: '促销结束',
  },
  {
    key: 'promotionBegin',
    label: '促销开始',
  },
];
